home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
276-300
/
294
/
dnet
/
amiga
/
lib
/
makechannel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-14
|
994b
|
49 lines
/*
* MakeChannel.C
*
* (internal routine)
*/
#include "lib.h"
short DUseSignal = -1;
void *
MakeChannel(ior, host)
IOSTD *ior;
char *host;
{
CHANN *chan = AllocMem(sizeof(CHANN), MEMF_PUBLIC|MEMF_CLEAR);
/* Name, Pri */
chan->port.mp_Node.ln_Type = NT_MSGPORT;
if (DUseSignal >= 0)
chan->port.mp_SigBit = DUseSignal;
else
chan->port.mp_SigBit = AllocSignal(-1);
chan->port.mp_SigTask = FindTask(NULL);
NewList(&chan->port.mp_MsgList);
NewList(&chan->rdylist);
chan->chan = (long)ior->io_Unit;
ior->io_Offset = (long)chan;
if (host) {
char buf[sizeof(DNETPORTNAME)+32];
sprintf(buf, "%s%s", DNETPORTNAME, host);
ior->io_Message.mn_ReplyPort = FindPort(buf);
}
chan->dnetport = ior->io_Message.mn_ReplyPort;
return((void *)chan);
}
void
DeleteChannel(_chan)
void *_chan;
{
CHANN *chan = (CHANN *)_chan;
if (chan->port.mp_SigBit != DUseSignal)
FreeSignal(chan->port.mp_SigBit);
FreeMem(chan, sizeof(CHANN));
}